      SUBROUTINE E02AJF(NP1,XMIN,XMAX,A,IA1,LA,QATM1,AIN,IAINT1,LAINT,
     *                  IFAIL)
C     MARK 8 RELEASE. NAG COPYRIGHT 1979.
C     MARK 9 REVISED. IER-315 (SEP 1981).
C     MARK 11.5(F77) REVISED. (SEPT 1985.)
C
C     * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C
C     NPL DATA FITTING LIBRARY ROUTINE CHBINT
C
C     CREATED 1/5/79    UPDATED 23/1/80     RELEASE NO. 00/03
C
C     AUTHORS.. GERALD T ANTHONY, MAURICE G COX, J GEOFFREY HAYES.
C     NATIONAL PHYSICAL LABORATORY
C     TEDDINGTON, MIDDLESEX, ENGLAND.
C
C     * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C
C     INPUT PARAMETERS
C        NP1    = N+1 WHERE N IS DEGREE OF GIVEN POLYNOMIAL
C        XMIN   LOWER LIMIT OF RANGE OF X
C        XMAX   UPPER LIMIT OF RANGE OF X
C        A      COEFFICIENTS A0, A1,...AN OF THE GIVEN POLYNOMIAL
C        IA1       ARE STORED IN ARRAY A IN POSITIONS 1, 1+IA1,...
C                  1+N*IA1, RESPECTIVELY
C        LA     THE DECLARED DIMENSION OF ARRAY A
C        QATM1  THE VALUE OF THE INTEGRATED POLYNOMIAL AT XMIN
C
C     OUTPUT PARAMETERS
C        AIN   THE COEFFICIENTS OF THE INTEGRATED POLYNOMIAL
C        IAINT1    ARE RETURNED IN ARRAY AIN IN POSITIONS
C                  1, 1+IAINT1,...1+NP1*IAINT1
C        LAINT  THE DECLARED DIMENSION OF ARRAY AIN
C        IFAIL  ERROR INDICATOR
C
C     INTEGRATE THE SERIES WITH COEFFICIENTS A OF DEGREE N
C     (I.E. NP1 COEFFICIENTS) TO OBTAIN THE SERIES WITH COEFFICIENTS
C     AIN OF DEGREE N + 1.  THE SUM OF THE INTEGRATED SERIES IS
C     QATM1 AT THE LEFT HAND END OF THE INTERVAL OF DEFINITION, XMIN
C
C     .. Parameters ..
      CHARACTER*6       SRNAME
      PARAMETER         (SRNAME='E02AJF')
C     .. Scalar Arguments ..
      DOUBLE PRECISION  QATM1, XMAX, XMIN
      INTEGER           IA1, IAINT1, IFAIL, LA, LAINT, NP1
C     .. Array Arguments ..
      DOUBLE PRECISION  A(LA), AIN(LAINT)
C     .. Local Scalars ..
      INTEGER           IERROR
C     .. Local Arrays ..
      CHARACTER*1       P01REC(1)
C     .. External Functions ..
      INTEGER           P01ABF
      EXTERNAL          P01ABF
C     .. External Subroutines ..
      EXTERNAL          E02AJZ
C     .. Executable Statements ..
      IERROR = 1
      IF ( .NOT. (NP1.GE.1 .AND. XMAX.GT.XMIN .AND. LA.GT.(NP1-1)
     *    *IA1 .AND. IA1.GE.1 .AND. IAINT1.GE.1 .AND. LAINT.GT.NP1*
     *    IAINT1)) GO TO 20
      IERROR = 0
      CALL E02AJZ(NP1,XMIN,XMAX,A,IA1,LA,QATM1,AIN,IAINT1,LAINT)
   20 IFAIL = P01ABF(IFAIL,IERROR,SRNAME,0,P01REC)
      RETURN
C     END OF E02AJF
      END
